package org.opu.pc.domain.dao;

import java.io.Serializable;
import java.util.List;

import org.opu.pc.domain.domains.AbstractDomain;

public interface AbstractDao
		<KeyType extends Serializable, T extends AbstractDomain<KeyType>> {

	public abstract T load(KeyType id);

	public abstract T get(KeyType id);

	public abstract List<T> getList();

	/**
	 * Persist the given transient instance.
	 * 
	 * @param object
	 *            the transient instance to persist
	 * @return the generated identifier
	 */
	public abstract KeyType save(T object);

	/**
	 * Save or update the given persistent instance, according to its id.
	 * 
	 * @param entity
	 *            the persistent instance to save or update
	 * @throws DataAccessException
	 *             in case of Hibernate errors
	 */
	public abstract void saveOrUpdate(T object);

	/**
	 * Delete the given persistent instance.
	 * 
	 * @param entity
	 *            the persistent instance to delete
	 * @throws org.springframework.dao.DataAccessException
	 *             in case of Hibernate errors
	 */
	public abstract void delete(T object);

}